Psi10c = eye(N);
Psi10 = Psi;

for i = 2:10
    Psi10c = Psi10c + Psi ^ (i - 1);
    Psi10 = Psi10 + Psi ^ i;
end

pred_coint = Psi10c * c' + Psi10 * X2t(1:(T - 10), :)';

X10 = X2t(2:(T - 9), :);

for i = 2:10
    X10 = X10 + X2t((i + 1):(T - 10 + i), :);
end

regx = [ones(T - 10, 1), X2t(1:(T - 10), :)];
regr = ols(X10(:, dtpos), regx);
fitted_dt = regx * regr.beta;
regr = ols(X10(:, dgpos), regx);
fitted_dg = regx * regr.beta;

ts_actual_dt = X10(:, dtpos);
ts_var10y_dt = pred_coint(dtpos, :)';
ts_ols10y_dt = fitted_dt;

rmse10y_dt = [mean((ts_actual_dt - ts_var10y_dt) .^ 2), ...
                  mean((ts_actual_dt - ts_ols10y_dt) .^ 2)] * 1e4;

ts_actual_dg = X10(:, dgpos);
ts_var10y_dg = pred_coint(dgpos, :)';
ts_ols10y_dg = fitted_dg;

rmse10y_dg = [mean((ts_actual_dg - ts_var10y_dg) .^ 2), ...
                  mean((ts_actual_dg - ts_ols10y_dg) .^ 2)] * 1e4;
